from google.appengine.ext import webapp
from google.appengine.ext.webapp.util import run_wsgi_app

from django.utils import simplejson as json

class MainPage(webapp.RequestHandler):
    def get(self):
        self.response.headers['Content-Type'] = 'text/plain'
        self.response.out.write('Hello,')

class RandomHandler(webapp.RequestHandler):
    def get(self):
        sample_dictionary = {'name': 'ben', 'id':4, 'expert':'true'}
        sample_output = json.dumps(sample_dictionary)
        self.response.headers['Content-Type'] = 'application/json'
        self.response.out.write(sample_output)

application = webapp.WSGIApplication(
                                     [('/', MainPage),
                                     ('/random', RandomHandler)],
                                     debug=True)

def main():
    run_wsgi_app(application)

if __name__ == "__main__":
    main()